getAjaxReq("statistics/totalUsers", null, function (res) {
    var totalUser = echarts.init(document.getElementById("totalUser"));
    var option = {
        legend: {
            data: ['人数'],
            orient: 'vertical',
            x: "right"
        }
    };
    if (res.code == 1){
        option.series =  [
            {
                name: '总用户数',
                type: 'pie',
                radius: ['70%', '60%'],
                center: ['50%', '50%'],
                color: ['#1fc8c1'],
                data: [{
                    value: res.data, name: '人数', label: {
                        show: true,
                        position: 'center',
                        formatter: function (params) {
                            return params.value
                        },
                        color: '#1fc8c1',
                        fontSize: 32
                    }, labelLine: {
                        show: false
                    }
                }]
            }
        ]
    } else {
        option.series = []
    }
    totalUser.setOption(option)
})
getAjaxReq("statistics/totalAmmeters", null, function (res) {
    var totalAmmeters = echarts.init(document.getElementById("totalAmmeters"));
    var option = {
        legend: {
            data: ['电表数'],
            orient: 'vertical',
            x: "right"
        }
    };
    if (res.code == 1) {
        option.series = [
            {
                name: '总电表数',
                type: 'pie',
                radius: ['70%', '60%'],
                center: ['50%', '50%'],
                color: ['#7086c8'],
                data: [{
                    value: res.data, name: '电表数', label: {
                        show: true,
                        position: 'center',
                        formatter: function (params) {
                            return params.value
                        },
                        color: '#7086c8',
                        fontSize: 32
                    }
                }]
            }
        ]
    }else {
        option.series = []
    }
    totalAmmeters.setOption(option)
})

